package com.exam.demo.controller.exam;


import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.exam.demo.domain.Book;
import com.exam.demo.domain.Table2;
import com.exam.demo.mapper.Table2Mapper;
import com.exam.demo.result.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

@RequestMapping("/exam")
@RestController
public class ExamController {


    @Autowired
    Table2Mapper baseMapper;

    @RequestMapping("/list")
    public R<List<Map<String,Object>>> list(){
        return R.ok(baseMapper.getList());
    }

    @RequestMapping("/addString/{str}")
    public R<String> addString(@PathVariable String str){
        //需要不重复的增删改查则加这一句
        /*if(!baseMapper.getUserByName(book).isEmpty()) return R.fail("该用户名已存在");*/
        return R.judge(baseMapper.insertString(str)>0);
    }


}
